package com.example.demo.controller;

import com.example.demo.entity.Usd;
import com.example.demo.service.UsdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/usd")
public class UsdController {
    @Autowired
    private UsdService usdService;

    @GetMapping("/add")
    public String add(@RequestBody Usd usd) {
        boolean ii = usdService.add(usd);
        if (ii == true) return "添加成功";
        return "添加失败";
    }

    @GetMapping("/delete")
    public String delete(Long id) {
        boolean dd = usdService.delete(id);
        if (dd == true) return "删除成功";
        return "删除失败";
    }

    @GetMapping("/update")
    public String update(@RequestBody Usd usd) {
        boolean uu = usdService.update(usd);
        if (uu == true) return "修改成功";
        return "修改失败";
    }
}
